from sqlalchemy import  String,Double
from sqlalchemy.orm import Mapped,mapped_column 


from . import MappedBase

class Obstacle(MappedBase):
    __tablename__ = 'obstacle'
   
    def __repr__(self) -> str:
        return f'<Modele obstacle {self.name}>'

    id:Mapped[int]=mapped_column(primary_key=True, index=True, autoincrement=True, comment='障碍物id')

    name:Mapped[str] = mapped_column(String(30), unique=False,nullable=False,comment='障碍物名称')

    x1: Mapped[float] = mapped_column(Double, nullable=False ,comment='障碍物的第1个顶点的x坐标')
    y1: Mapped[float] = mapped_column(Double, nullable=False ,comment='障碍物的第1个顶点的y坐标')

    x2: Mapped[float] = mapped_column(Double, nullable=False ,comment='障碍物的第2个顶点的x坐标')
    y2: Mapped[float] = mapped_column(Double, nullable=False ,comment='障碍物的第2个顶点的y坐标')

    x3: Mapped[float] = mapped_column(Double, nullable=False ,comment='障碍物的第3个顶点的x坐标')
    y3: Mapped[float] = mapped_column(Double, nullable=False ,comment='障碍物的第3个顶点的y坐标')

    x4: Mapped[float] = mapped_column(Double, nullable=False ,comment='障碍物的第4个顶点的x坐标')
    y4: Mapped[float] = mapped_column(Double, nullable=False ,comment='障碍物的第4个顶点的y坐标')


    
